$(function () { $("a[target=_blank]:not(.LoadingOff)").click(function () { return false; }); //tuanha: #mainNav ul ul a, .AccountPage a, $(".LoadingOn, .BackLink, #mainNav ul ul a, .CustomerInfo a, .LangRow a,.SideBar a[target!=_blank]:not(.LoadingOff), .UserAccountPage a").click(loading); var d = new Date(); var date = d.getDate(); permission(); //Renders methods // Submit - call service - Not check input $(".IdCallServiceNotCheckInput").click(function () { // count down $(".CountDownReload").each(function () { var $this = $(this); $this.text("150"); var time = parseInt($this.text()); var i = 0; var int = self.setInterval(function () { $this.text(time - i); if (i > time) { $this.prev().click(); $this.remove(); int = window.clearInterval(int); }; i++; }, 1000); }); // show loading loading(); }); // Submit - call service - check input $(".IdCallService").click(function () { var error = 0; $(".RequiredInput").each(function () { var $this = $(this); if ($this.val() == "") { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize35").each(function () { var $this = $(this); if ($this.val().length > 34) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize50").each(function () { var $this = $(this); if ($this.val().length > 49) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize100").each(function () { var $this = $(this); if ($this.val().length > 99) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize150").each(function () { var $this = $(this); if ($this.val().length > 150) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize200").each(function () { var $this = $(this); if ($this.val().length > 199) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); if (error > 0) return false; // count down $(".CountDownReload").each(function () { var $this = $(this); $this.text("150"); var time = parseInt($this.text()); var i = 0; var int = self.setInterval(function () { $this.text(time - i); if (i > time) { $this.prev().click(); $this.remove(); int = window.clearInterval(int); }; i++; }, 1000); }); // show loading loading(); }); // $(".Captcha").val(""); $(".TransactionDetails .DataTable").each(function () { if ($("tr", this).length <= 1) $(this).hide(); }); // $(".LPBAcc").each(function () { // var Acc = $(this).text(); // $(this).text(formatAccLPB(Acc)); // }); $(".AccountPage .DataPanel").each(function () { var $this = $(this).clone(); $("tr:not(:first)", $this).remove(); var tr = $("tr", this); var clone = 0; if (tr.length > 10) { tr.each(function () { var ccy = $("td:last", this).text(); if (ccy != "VND" && ccy.length == 3) { $(this).appendTo($("table", $this)); clone++; }; }); if (clone > 0) { $("h3 .VND", $this).hide(); $("h3 .Virtual", $this).show(); $this.appendTo($(this).parent()); }; }; }); $(".ListAccounts").each(function () { sumaryMoney(this); }); if ($("#totalTransferTo").length > 0) calculateTotalTransferTo(); if ($(".Unique:checked").length == 0) $(".Unique:first").attr('checked', 'checked'); $(".FormatMoney, .FormatMoneyLeft, .FormatMoneyRight").each(function () { var $this = $(this); var value = $this.text(); $this.attr('number', value); $this.text(CurrencyFormatted(value)); }); $(".FormatMoney_With_VND").each(function () { var $this = $(this); var value = $this.text(); $this.attr('number', value); $this.text(CurrencyFormatted(value) + " VND"); }); $(".InputMoney").each(function () { value = $(this).val(); value = value.replace(/,/g, '') if (value == "") return false; //value = "0"; value = parseFloat(value); thisMoney = $(this).parent().next().find("span"); money = parseFloat(thisMoney.attr("number")); total = money - value; thisMoney.text(CurrencyFormatted("" + total)); $(this).val(CurrencyFormatted("" + value)); }); //tuanha: 17/5/2017 $(".MoneyInput").keyup(function(event) { // skip for arrow keys if(event.which >= 37 && event.which <= 40) return; // format number $(this).val(function(index, value) { return value .replace(/\D/g, "") .replace(/\B(?=(\d{3})+(?!\d))/g, ",") ; }); //xoa so 0 o dau var inputVal = $(this).val(); if(inputVal.substring(0, 1) == '0' && inputVal.length >= 2){ $(this).val(inputVal.substring(1)); } }); $(".MoneyInput").each(function(event) { $(this).val(function(index, value) { return value .replace(/\D/g, "") .replace(/\B(?=(\d{3})+(?!\d))/g, ",") ; }); }); $(".InputMoney").blur(function () { val = $(this).val(); if (val.charAt(val.length - 1) == ".") return true; value = parseFloat(val.replace(/,/g, '')); thisMoney = $(this).parent().next().find("span"); money = parseFloat(thisMoney.attr("number")); total = money - value; thisMoney.text(CurrencyFormatted("" + total)); calculateTotalTransferTo(); $(this).val(CurrencyFormatted("" + value)); }); $(".InputMoney").keydown(function(event) { // Allow only backspace,delete,left arrow,right arraow and Tab if ( event.keyCode == 46 // delete || event.keyCode == 8 // backspace || event.keyCode == 37 // left arrow || event.keyCode == 39 // right arrow || event.keyCode == 36 // home || event.keyCode == 35 // emd || event.keyCode == 190 // period . (main) || event.keyCode == 110 // period . (numpad) || event.keyCode == 17 // ctrl || event.keyCode == 109 // - || event.keyCode == 9) // tab { // let it happen, don't do anything } else { // Ensure that it is a number and stop the keypress if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode <96 ||event.keyCode > 105) ) { event.preventDefault(); } } }); $(".InputMoney2").each(function () { value = $(this).val(); value = value.replace(/,/g, '') if (value == "") return false; //value = "0"; value = parseFloat(value); thisMoney = $(this).parent().next().find("span"); money = parseFloat(thisMoney.attr("number")); total = money - value; thisMoney.text(CurrencyFormatted("" + total)); $(this).val(CurrencyFormatted("" + value)); }); $(".InputMoney2").blur(function () { val = $(this).val(); if (val.charAt(val.length - 1) == ".") return true; value = parseFloat(val.replace(/,/g, '')); thisMoney = $(this).parent().next().find("span"); money = parseFloat(thisMoney.attr("number")); total = money - value; thisMoney.text(CurrencyFormatted("" + total)); calculateTotalTransferTo(); $(this).val(CurrencyFormatted("" + value)); }); $(".InputMoney2").keydown(function(event) { // Allow only backspace,delete,left arrow,right arraow and Tab if ( event.keyCode == 46 // delete || event.keyCode == 8 // backspace || event.keyCode == 37 // left arrow || event.keyCode == 39 // right arrow || event.keyCode == 36 // home || event.keyCode == 35 // emd || event.keyCode == 17 // ctrl || event.keyCode == 109 // - || event.keyCode == 9) // tab { // let it happen, don't do anything } else { // Ensure that it is a number and stop the keypress if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode <96 ||event.keyCode > 105) ) { event.preventDefault(); } } }); $(".InputMoneyText").blur(function () { val = $(this).val(); value = parseFloat(val.replace(/,/g, '')); if (isNaN(value)){ return true; } if (val.charAt(val.length - 1) == ".") return true; $(this).val(CurrencyFormatted("" + value)); }); $(".RemoveSpecialChar").keydown(function(){ $(this).val($(this).val().replace(/(?!\w|\s)./g, '') .replace(/\s+/g, ' ') .replace(/^(\s*)([\W\w]*)(\b\s*$)/g, '$2')); }); $(".RemoveSpecialChar").blur(function(){ $(this).val($(this).val().replace(/(?!\w|\s)./g, '') .replace(/\s+/g, ' ') .replace(/^(\s*)([\W\w]*)(\b\s*$)/g, '$2')); }); $(".RemoveSpecialChar").keyup(function(){ $(this).val($(this).val().replace(/(?!\w|\s)./g, '') .replace(/\s+/g, ' ') .replace(/^(\s*)([\W\w]*)(\b\s*$)/g, '$2')); }); // DATE FUNCTION /*$(".DatePickerTable input:eq(0)").click(); if($(".radioboxSelected").text() == '1'){ $(".DatePickerTable input:eq(0)").click(); }else if($(".radioboxSelected").text() == '0'){ $(".DatePickerTable input:last").click(); $("#rangeDate").show().addClass("Active"); $("#StatementTerm").hide().removeClass("Active"); } */ var selectRadioTime = $(".DatePickerTable input:last").is(':checked'); if(selectRadioTime){ $("#rangeDate").show().addClass("Active"); } $(".DatePickerTable input:last").change(function () { var d = new Date(); var month = d.getMonth()+1; var day = d.getDate(); var currDate = (day<10 ? '0' : '') + day + '/' + (month<10 ? '0' : '') + month + '/' + d.getFullYear(); $("#rangeDate").show().addClass("Active"); $(".InputDate").val(currDate); $("#StatementTerm").hide().removeClass("Active"); }); $(".DatePickerTable input:not(:last)").change(function () { $("#rangeDate").hide().removeClass("Active"); $(".InputDate").val(''); $("#StatementTerm").show().addClass("Active"); }); // use credit-card $(".DatePickerTable1 input:eq(0)").click(); if($(".radioboxSelected").text() == '1'){ $(".DatePickerTable1 input:eq(1)").click(); }else if($(".radioboxSelected").text() == '0'){ $(".DatePickerTable1 input:eq(2)").click(); $("#rangeDate").show().addClass("Active"); $("#StatementTerm").hide().removeClass("Active"); }else if($(".radioboxSelected").text() == '2'){ $(".DatePickerTable1 input:eq(0)").click(); $("#rangeDate").show().addClass("Active"); $("#StatementTerm").hide().removeClass("Active"); } $(".DatePickerTable1 input:eq(0)").change(function () { $("#rangeDate").show().addClass("Active"); $(".InputDate").val(''); $("#StatementTerm").hide().removeClass("Active"); }); $(".DatePickerTable1 input:eq(1)").change(function () { $("#rangeDate").hide().removeClass("Active"); $(".InputDate").val(''); $("#StatementTerm").show().addClass("Active"); }); $(".DatePickerTable1 input:eq(2)").change(function () { $("#rangeDate").show().addClass("Active"); $(".InputDate").val(''); $("#StatementTerm").hide().removeClass("Active"); }); // END $(".NormalDate .InputDate").datepicker( { dateFormat : 'dd/mm/yy' }); $(".TransDate .InputDate").datepicker( { dateFormat : 'dd/mm/yy', minDate : new Date(), changeMonth : true, changeYear : false, hideIfNoPrevNext : true, gotoCurrent: true }); $(".TransactionOptions .InputDate").datepicker( { dateFormat : 'dd/mm/yy' }); $(".TransferDate .InputDate").datepicker( { dateFormat : 'dd/mm/yy', minDate : new Date(), maxDate : "+1m -" + date + "d", hideIfNoPrevNext : true }); $(".IDDate .InputDate").datepicker( { dateFormat : 'dd/mm/yy', maxDate : new Date(), hideIfNoPrevNext : true, changeMonth : true, changeYear : true, yearRange : 'c-50:c' }); $(".InputDate_Insurance").datepicker( { dateFormat : 'dd/mm/yy' }); // if ($(".CustomBankName").val() != "") { $(".CustomBank").show(); $(".PresetBanks").hide(); }; $("#customBankName").click(function () { $(".CustomBank").show(); $(".PresetBanks").hide(); }); $("#presetBankName").click(function () { $(".CustomBankName").val(""); $(".CustomBank").hide(); $(".PresetBanks").show(); }); if ($(".ExtAccType input:checked").val() == "CMND") { $(".IDGroup").show(); $(".ACCGroup").hide(); }; $(".ExtAccType input").change(function () { if ($(this).val() == "CMND") { $(".IDGroup").show(); $(".ACCGroup").hide(); } else { $(".IDGroup").hide(); $(".ACCGroup").show(); }; }); $('.Unique').on('change', function() { $('.Unique').not(this).prop('checked', false); }); $('.UniqueNoDefault').on('change', function() { $('.UniqueNoDefault').not(this).prop('checked', false); }); $(".future_transfer").click(function () { if ($(this).is(':checked')) { $(".panel_future_transfer").show(); } else { $(".panel_future_transfer").hide(); }; }); $(".Messages").each(function () { if ($(this).text().replace(/(^\s*|\s*$)/, "").length > 5) if ($(this).hasClass("Info")) { $(this).dialog( { autoOpen : true, minHeight : '75px', dialogClass : "InfoMessages" }); } else { $(this).dialog( { autoOpen : true, minHeight : '75px' }); }; }); $(".StatementsTable tr").each(function () { if ($("td:eq(0)", this).text() == "") $(this).addClass("HL"); }); $(".MessageBody").each(function () { var text = this.innerHTML.replace(/</g, "<").replace(/>/g, ">"); $(this).html(text); }); $(".SideBar").wrap('
'); if ($(document).height() > $(window).height() + 500) { $(window).scroll(function () { if ($(window).scrollTop() > 245) $(".SideBar").addClass("FixedLayout"); else $(".SideBar").removeClass("FixedLayout"); }); }; //Init style var pageId = $("#pageId").text(); if (pageId != "start") navActive(pageId); $(".DataTable tr").hover(function () { $(this).addClass("Hover"); }, function () { $(this).removeClass("Hover"); }); $(".InfoTitle a").click(function () { var div = $(this).parent().next(); if (div.hasClass("Hidden")) { div.removeClass("Hidden").show(); $("span", this).text("-"); } else { div.addClass("Hidden").hide(); $("span", this).text("+"); } return false; }); if ($(".NoStyleTable").length != 0) { if ($(".NoStyleTable input:checked").val() == "N") { $(".CaptchaRow").hide(); }; $(".NoStyleTable input").change(function () { if ($(this).val() == "N") { $(".CaptchaRow").hide(); } else { $(".CaptchaRow").show(); }; }); }; if ($("#pickUserFavAcc").length != 0) { $("#pickUserFavAcc").click(function () { $(".FavAcc").slideDown("fast"); $(this).hide(); return false; }); $(".FavAcc tr:not(:has(a,th))").remove(); }; if ($('.TransactionManagement').length > 0) { $('.TransactionManagement .DataPanel').each(function () { if ($('tr', this).length == 1) { $(this).hide(); }; }); if ($('.TransactionManagement .DataPanel:visible').length == 0) $('.TransactionManagement .DataPanel:last').removeClass('Virtual'); }; $(".CountDownCancel").each(function () { var $this = $(this); var time = parseInt($this.text()); var i = 0; var int = self.setInterval(function () { $this.text(time - i); if (i > time) { $this.prev().click(); $this.remove(); int = window.clearInterval(int); }; i++; }, 1000); }); $(".CountDownReload2s").each(function () { var $this = $(this); var time = parseInt($this.text()); var i = 0; var int = self.setInterval(function () { $this.text(time - i); if (i > time) { $this.prev().click(); $this.remove(); int = window.clearInterval(int); }; i++; }, 1000); }); if ($(".SingleCheckbox:checked").length == 0) $(".SingleCheckbox:first").attr('checked', 'checked'); $('.SingleCheckbox').on('change', function() { $('.SingleCheckbox').not(this).prop('checked', false); }); if ($(".MultiCheckbox:checked").length == 0) $(".MultiCheckbox:first").attr('checked', 'checked'); // checkall khi vừa load pages $(".MultiCheckboxAll:first").attr('checked', 'checked'); if ($(".MultiCheckboxAll:checked").length > 0) $('input:checkbox').attr('checked','checked'); // action cho checkall $(".MultiCheckboxAll").click(function () { if($(this).attr("checked")) $('input:checkbox').attr('checked','checked'); else $('input:checkbox').removeAttr('checked'); }); // action cho item check $(".MultiCheckbox1").click(function () { if($(this).attr("checked")) { if($(".MultiCheckbox1").length == $(".MultiCheckbox1:checked").length) $('input:checkbox').attr('checked','checked'); } else $(".MultiCheckboxAll:checked").attr("checked", null); }); //Common Validate $("form").each(function () { $(".clientDate").val(getClientDate()); $(".clientDay").val(getClientDate(1)); $(".clientMonth").val(getClientDate(2)); $(".clientYear").val(getClientDate(3)); //$(".windowName").val(randomName); }); $("form").submit(function () { // PHAN CHUNG $(".ValidateMessages").hide(); $(".BackLink").click(function () { return true; }); $(".NotCheckInput").click(function () { return true; }); var error = 0; // Check empty $(".RequiredInput:visible").each(function () { var $this = $(this); if ($this.val() == "") { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); if (error > 0){ $("#IdErrorEmptyData").dialog( { minHeight : '75px' }); return false; } // checkbox empty $(".MultiCheckbox1:visible").each(function () { if ($(".MultiCheckbox1:checked").length == 0){ error++; } }); if (error > 0){ $("#IdErrorEmptyCheckbox").dialog( { minHeight : '75px' }); return false; } // Check max length $(".TextSize35:visible").each(function () { var $this = $(this); if ($this.val().length > 34) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize50:visible").each(function () { var $this = $(this); if ($this.val().length > 49) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize100:visible").each(function () { var $this = $(this); if ($this.val().length > 99) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize150:visible").each(function () { var $this = $(this); if ($this.val().length > 150) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize200:visible").each(function () { var $this = $(this); if ($this.val().length > 199) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); $(".TextSize_ExtDesc:visible").each(function () { var $this = $(this); if ($this.val().length > 100) { error++; $this.focus().addClass("Error"); } else { $this.removeClass("Error"); }; }); if (error > 0){ $("#IdErrorMaxLength").dialog( { minHeight : '75px' }); return false; } // Check Date format $(".InputDate:visible").each(function () { if (!$(this).val().match(/[0-9][0-9]\/[0-1][0-9]\/[1-2][0-9][0-9][0-9]/)) { error++; $(this).focus().addClass("Error"); } else { $(this).removeClass("Error"); }; }); if (error > 0){ $("#IdWrongDateFormat").dialog( { minHeight : '75px' }); return false; } // Check Amount $(".InputMoney:visible").each(function () { var value = $(this).val().replace(/,/g, ''); //while (value.substr(0, 1) == "0") { // value = value.substr(1); //}; //if (!value.match(/\d$/) || value == "") { // error++; // $(this).focus().addClass("Error"); //} //else { // $(this).removeClass("Error"); //}; $(this).val(value); }); $(".InputMoney2:visible").each(function () { var value = $(this).val().replace(/,/g, ''); //while (value.substr(0, 1) == "0") { // value = value.substr(1); //}; //if (!value.match(/\d$/) || value == "") { // error++; // $(this).focus().addClass("Error"); //} //else { // $(this).removeClass("Error"); //}; $(this).val(value); }); //if (error > 0){ // $("#IdWrongMoneyFormat").dialog( { // minHeight : '75px' // }); // return false; //} //tuanha: 17/5/2017 // Check Amount $(".MoneyInput:visible").each(function () { var value = $(this).val().replace(/,/g, ''); $(this).val(value); }); // Check Confirm info if ($(".Pass1").val() != $(".Pass2").val()) { error++; $(".Pass2").focus().addClass("Error"); } else { $(".Pass2").removeClass("Error"); }; if (error > 0){ $("#IdConfirmInfoNotMatch").dialog( { minHeight : '75px' }); return false; } // CAC PHAN RIENG - LIEN NGAN HANG if ($(".PresetBanks:visible").length > 0) $(".bankName").val($(".BankCode option:selected").text()); else $(".bankName").val($(".BankCodeBk option:selected").text()); // CAC PHAN RIENG - LOGIN //$('.LoginInput').val($('.LoginInput').val().replace(/(^\s*|\s*$)/g, "")); // Disable submit click when processing $('.InputSumbit', this).click(function () { return false; }); $(".css_Begin_Date").removeAttr('disabled'); $(".css_End_Date").removeAttr('disabled'); return true; }); /* Manual Format Date - Begin */ $(document).ready(function(){ $("#css_RangeDate").show().addClass("Active"); var l_ItemVal = $('.css_ChangeDatePickerMenu').val(); var l_Current_Begin_DT = new Date(); var l_Current_End_DT = new Date(); if(l_ItemVal==2){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 1); // $(".css_Begin_Date").val(fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber( l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber(( l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); } else if(l_ItemVal==7){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 6); // $(".css_Begin_Date").val( fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber(l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); } else if(l_ItemVal==30){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 29); // $(".css_Begin_Date").val( fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber(l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); }else{ // document ready khong co //$(".css_Begin_Date").val(''); //$(".css_End_Date").val(''); // $(".css_Begin_Date").removeAttr('disabled'); $(".css_End_Date").removeAttr('disabled'); } var l_ItemValFilter = $(".css_ChangeFilterPickerMenu").val(); if(l_ItemValFilter=="NONE"){ $(".cssWidth_FilterNew").attr("disabled","disabled"); $(".cssWidth_Filter_Viettel").attr("disabled","disabled"); } else if (l_ItemValFilter=="AMOUNT"){ $(".cssWidth_Filter_Viettel").attr("disabled","disabled"); } }); $(".css_ChangeDatePickerMenu").change(function(e) { var l_ItemVal = $(this).val(); var l_Current_Begin_DT = new Date(); var l_Current_End_DT = new Date(); if(l_ItemVal==2){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 1); // $(".css_Begin_Date").val(fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber( l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber(( l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); } else if(l_ItemVal==7){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 6); // $(".css_Begin_Date").val( fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber(l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); } else if(l_ItemVal==30){ l_Current_Begin_DT.setDate(l_Current_End_DT.getDate() - 29); // $(".css_Begin_Date").val( fnFormat_DateNumber(l_Current_Begin_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_Begin_DT.getMonth()+1)) + '/' + l_Current_Begin_DT.getFullYear()); $(".css_End_Date").val( fnFormat_DateNumber(l_Current_End_DT.getDate()) + '/' + fnFormat_DateNumber((l_Current_End_DT.getMonth()+1)) + '/' + l_Current_End_DT.getFullYear()); // $(".css_Begin_Date").attr("disabled","disabled"); $(".css_End_Date").attr("disabled","disabled"); }else{ // document ready khong co $(".css_Begin_Date").val(''); $(".css_End_Date").val(''); // $(".css_Begin_Date").removeAttr('disabled'); $(".css_End_Date").removeAttr('disabled'); } }); $(".css_ChangeFilterPickerMenu").change(function(e) { var l_ItemVal = $(this).val(); $(".cssWidth_FilterNew").val(''); $(".cssWidth_Filter_Viettel").val(''); //$(".cssWidth_FilterNew").removeClass('InputMoney'); if(l_ItemVal=="NONE"){ $(".cssWidth_Filter_Viettel").attr("disabled","disabled"); $(".cssWidth_FilterNew").attr("disabled","disabled"); }else if(l_ItemVal=="CUSTOMER_NAME"||l_ItemVal=="AMOUNT"){ $(".cssWidth_FilterNew").removeAttr('disabled'); $(".cssWidth_Filter_Viettel").attr("disabled","disabled"); }else { $(".cssWidth_FilterNew").removeAttr('disabled'); $(".cssWidth_Filter_Viettel").removeAttr('disabled'); } /*if(l_ItemVal=="AMOUNT"||l_ItemVal=="RANGE_AMOUNT") { $(".cssWidth_FilterNew").addClass('InputMoney'); }*/ }); /* Manual Format Date - End */ //tuanha:04/09/2015 $(".hoe-sub-menu").children().each(function(e) { if($(this).hasClass("Active")) $(this).parent().css({"display":"block"}); }); //tuanha:26/2/2015 if( $("#navTransferDomMulti").length) // ck noi bo { // ton tai menu nay -> cho visible shotcurt trang chu len $(".navTransferDomMulti").removeClass("Invisible"); //CK LienVietPostBank } if( $("#navTransferExt").length) // ck noi bo { $(".navTransferExt").removeClass("Invisible"); //CK lien NH } if( $("#navCardTransfer").length) // ck qua the { $(".navCardTransfer").removeClass("Invisible"); //CK qua the } if( $("#navTransferNapas").length) // ck so tk napas { $(".navTransferNapas").removeClass("Invisible"); //CK so tk napas } if( $("#navPaymentTopup").length)// ck noi bo { $(".navPaymentTopup").removeClass("Invisible"); //CK qua the } if( $("#navPaymentBillpay").length) // ck noi bo { $(".navPaymentBillpay").removeClass("Invisible"); //CK qua the } if( !$("#navTransferExt").length && !$("#navCardTransfer").length) { $("#ck_short").addClass("Invisible"); $("#ck_title").addClass("Invisible"); $("#tt_title").addClass("Invisible"); $("#ins_lpb").removeClass("Invisible"); $("#insurance_lpb").removeClass("Invisible"); } if( $("#viettelQueryAccount").length) { $("#insurance_lpb").children().removeClass("insurance_icon"); $("#insurance_lpb").children().addClass("viettel_icon"); } //citad: do kh copy paste ky tu dac biet, can check va replace $(".checkQuotation").blur(function(){ var value = this.value ; // dau cach dac biet (–), do KH copy roi paste vao, can replace bang dau (-) if (value.indexOf('–') !== -1){ var newVal = value.replace(/\–/g,'-'); $(this).val(newVal); } }); //tuanha: sua trang home 21/6/2017 $(".TableOnClick tbody tr").click(function () { var href = $(this).find("a").attr("href"); $(this).find("a").click(); }); $('a').click(function(e){ e.stopImmediatePropagation(); }); //chan bam F5 /* window.onload = function () { document.onkeydown = function (e) { return (e.which || e.keyCode) != 116; }; } */ if($("#hoeapp-wrapper").length == 0) { //it doesn't exist // $(".PageRefresh").click(); //alert("ok132"); }else{ //alert("ok2"); } $(".img_logout").on({ "mouseover" : function() { this.src = './images/thoat_hover.png'; }, "mouseout" : function() { this.src='./images/thoat.png'; } }); $(".logo-lpb").click(function(e) { window.open('http://www.lienvietpostbank.com.vn/','_blank'); }); /*tuanha: 15/10/2015; tt credit*/ if($('.Card_Amount').length && $(".Card_Amount").val().length == 0 ){ var minAmt = $(".Min_Amount").text(); var ceilNum = Math.ceil(minAmt.replace(/,/g , '')); var numFormat = ceilNum.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); $(".Card_Amount").val(CurrencyFormatted("" + numFormat)); } if($(".Card_Amount").length != 0 && $(".Min_Amount").length != 0){ var cardAmt = $(".Min_Amount").text(); var ceilNum2 = Math.ceil(cardAmt.replace(/,/g , '')); var numFormat2 = ceilNum2.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); $(".Card_Amount").val(numFormat2); } if($(".Card_Amount").length != 0 && $(".Min_Amount").length == 0){ $(".Card_Amount").val(''); } $(".TokenPinHidden").keydown(function(event) { var numText = $(this).val().length ; if(numText == 4){ $(".TokenOTPCode").focus(); } if(numText < 4 && event.keyCode == 9) $(this).focus(); }); $(".TokenOTPCode").keydown(function(event) { var numText = $(this).val().length ; if(numText == 0 && event.keyCode == 8) $(".TokenPinHidden").focus(); }); $( ".TokenOTPCode" ).focus(function() { var tokenHide = $(".TokenPinHidden").val().length; if(tokenHide < 4 ){ $(this).val(''); $(".TokenPinHidden").focus(); } }); /* $(window).resize(function() { var divH = $(".test1").height(); alert(divH); }); */ //alert("tuantest", $("#test1").height()); //tuanha: 28/4/2016 - chu ky so if($("#executeSign").text() == "DIGITAL_SIGN"){// neu chon radion Chu ky so, thi goi ham signData() //initPlugin(); signData(); // getCertifcate(); } /*if($('#checkPlugin').text() == "DIGITAL_SIGN"){// neu chon radion Chu ky so, thi goi ham signData() checkPlugin(); }*/ //tuanha: 5/5/2017 fixed table-responsive for iphone var deviceWidth = window.screen.width; var deviceHeight = window.screen.height; if(window.orientation == 0){ resizeMobileDevice(deviceWidth); } //resizeMobileDevice(deviceWidth); //truyen tham so width , de set lai width cua table-responsive function resizeMobileDevice(width){ if(width > 0 && width < 768){ var last_fixedWidth = width - 32; $(".table-responsive").css("width", last_fixedWidth+'px'); $(".ui-dialog").css("left", (width-300)/2+'px' ); } } //khi xoay man hinh window.addEventListener("orientationchange", function() { var orient = window.orientation; // alert(orient); if(orient == 0){ //portrait resizeMobileDevice(deviceWidth); }else if(orient == 90 || orient == -90){ //landscape resizeMobileDevice(deviceHeight); } }, false); $('.SoTien').keyup(function(event){ // skip for arrow keys if(event.which >= 37 && event.which <= 40){ event.preventDefault(); } var $this = $(this); var num = $this.val().replace(/,/gi, "").split("").reverse().join(""); var num2 = RemoveRougeChar(num.replace(/(.{3})/g,"$1,").split("").reverse().join("")); // the following line has been simplified. Revision history contains original. $this.val(num2); }); function RemoveRougeChar(convertString){ if(convertString.substring(0,1) == ","){ return convertString.substring(1, convertString.length) } return convertString; } });